Skip to main content

You don't need an assertion library

We've grown accustomed to fancy assertions. But do they provide value?

These are the assertions that I regularly use in my day-to-day coding life:

  • assert that an object has a specific value
  • assert that an object has a specific shape
  • assert that a function throws a specific error
  • assert that a function rejects with a specific error
  • occasionally: assert about a boolean test

object a is/is not the same instance as object b